package com.example.first;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import java.text.BreakIterator;

public class ScoreActivity extends AppCompatActivity {
    TextView scoreA;
    TextView scoreB;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score);
        scoreA = findViewById(R.id.scoreA);
        scoreB = findViewById(R.id.scoreB);
    }

    public void myClick(View btn) {
        int a = Integer.parseInt(scoreA.getText().toString());
        int b = Integer.parseInt(scoreB.getText().toString());
        if (btn.getId() == R.id.btn1) {
            a = a + 3;
            String A = String.valueOf(a);
            scoreA.setText(A);
        } else if (btn.getId() == R.id.btn2) {
            a = a + 2;
            String B = String.valueOf(a);
            scoreA.setText(B);
        } else if (btn.getId() == R.id.btn3) {
            a = a + 1;
            String C = String.valueOf(a);
            scoreA.setText(C);
        } else if (btn.getId() == R.id.btn4) {
            b = b + 3;
            String D = String.valueOf(b);
            scoreB.setText(D);
        }else if (btn.getId() == R.id.btn5) {
            b = b + 2;
            String E = String.valueOf(b);
            scoreB.setText(E);
        }else if (btn.getId() == R.id.btn6) {
            b = b + 1;
            String F = String.valueOf(b);
            scoreB.setText(F);
        }else {
            scoreA.setText("0");
            scoreB.setText("0");
        }
    }
}